
<template>
  <vue-ueditor-wrap v-model="ueditorContent" :config="myConfig"></vue-ueditor-wrap>
</template>

<script>
  import VueUeditorWrap from "vue-ueditor-wrap"; // ES6 Module
  import {getAppApiUrl, getToken} from '@/utils/auth'
  export default {
    name: 'BaiDuEditor',
    props: {
      value: {
        type: String,
        default: ''
      },
      height: {
        type: Number,
        required: false,
        default: 350
      }
    },
    data () {
      return {
        ueditorContent:this.value,
        // ueditor
        myConfig: {
          // 编辑器不自动被内容撑高
          autoHeightEnabled: false,
          // 初始容器高度
          initialFrameHeight: this.height,
          // 工具栏是否可以浮动
          autoFloatEnabled: false,
          // 初始容器宽度
          initialFrameWidth: '100%',
          // 关闭自动保存
          enableAutoSave: true,
          //编辑器文件位置
          UEDITOR_HOME_URL: "/static/UEditor/",
          //服务请求地址
          serverUrl: getAppApiUrl() + "/sysCommon/ueditor?token=" + getToken() + "&timestamp=" + new Date().getTime()
        },
      }
    },
    components: {VueUeditorWrap}
  }
</script>
